#pragma once

#include "i_alloc.h"

namespace idl
{
  template<typename T1, typename T2> 
  struct Pair
  {
    T1 first; 
    T2 second;
    Pair(){};
    Pair(const Pair<T1, T2>& p)
    {
      first = p.first;
      second = p.second;
    }
    Pair& operator=(const Pair<T1, T2>& p)
    {
      this->first = p.first;
      this->second = p.second;
      return(*this);
    }
    Pair(const T1& a, const T2& b) : first(a), second(b){};
  };

  template<typename T1, typename T2> 
  inline Pair<T1, T2> i_make_pair(const T1& a, const T2& b)
  { 
    return Pair<T1, T2>(a, b);
  }

  template<typename T1, typename T2>
  inline bool i_less_pair_first_element(const Pair<T1, T2>& a, const Pair<T1, T2>& b)
  {
    return a.first < b.first;
  }

  template<typename T1, typename T2>
  inline bool i_less_pair_second_element(const Pair<T1, T2>& a, const Pair<T1, T2>& b)
  {
    return a.second < b.second;
  }

  template<typename T1, typename T2>
  inline bool i_larger_pair_first_element(const Pair<T1, T2>& a, const Pair<T1, T2>& b)
  {
    return a.first > b.first;
  }

  template<typename T1, typename T2>
  inline bool i_larger_pair_second_element(const Pair<T1, T2>& a, const Pair<T1, T2>& b)
  {
    return a.second > b.second;
  }


} /*namespace idl*/